function k = kernel(p,s1,s2,a1,a2)
% k = kernel(param,sens1,sens2,act1,act2)
%
% kernel subfunction for GPSARSA
%
% tobias siegfried, 10/08/08
% revision: 10/11/08
% revision: 12/18/08, adding support for polynomial kernels

%k = (gaussK(s1,s2,p.kSigmaS) .* linK(a1,a2,p.kSigmaA));
%k = gaussK(s1,s2,p.kSigmaS,p.cPriorV) .* gaussK(a1,a2,p.kSigmaA,p.cPriorV);
%k = gaussK(s1,s2,p.kSigmaS,p.cPriorV) .* polyK(a1,a2,p.polyKDegree);

switch p.kernels2use
    case 'pp'
        k = polyK(s1,s2,p.polyKDegree) .* polyK(a1,a2,p.polyKDegree);
    case 'gp'
        k = gaussK(s1,s2,p.kSigmaS,p.cPriorV) .* polyK(a1,a2,p.polyKDegree);
    case 'gg'
        k = gaussK(s1,s2,p.kSigmaS,p.cPriorV) .* gaussK(a1,a2,p.kSigmaA,p.cPriorV);
    case 'pg'
        k = polyK(s1,s2,p.polyKDegree) .* gaussK(a1,a2,p.kSigmaA,p.cPriorV);
    case 'gl'
        k = (gaussK(s1,s2,p.kSigmaS,p.cPriorV) .* linK(a1,a2,p.kSigmaA));
end